<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<volist name="fields" id="vo">
    <switch name="$vo.dtype">
        <case value="text">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-input-block">
                    <input type="text" name="catpost[{$vo.name}]" lay-verify="{$vo.name}" autocomplete="off" placeholder="请输入{$vo.title}" value="{$post[$vo.name]|default=''}" class="layui-input">
                </div>
            </div>
        </case>
        <!-- 单行文本结束 -->
        <!-- 单图上传开始 -->
        <case value="img">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-upload layui-input-block" style="display: flex;width: 17%;flex-wrap: wrap;justify-content: left;">
                    <button type="button" class="layui-btn" id="layui-img-ui{$key}" style="padding: 0 30px;">上传图片</button>
                    <div class="layui-upload-list">
                        <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($post[$vo.name])}');" style="margin-bottom: 10px;">
                            <img 
                                class="imgsrc-{$vo.name}-{$key}" 
                                id="photo-{$vo.name}-{$key}-preview" 
                                src="{:cmf_get_image_preview_url($post[$vo.name])}" 
                                style="width: 115px;height:100px;border: 1px">
                        </a>
                        <p id="demoText"></p>
                        <div class="hiddenspan">
                            <input type="hidden" name="img_one" value="img">
                            <input class="layui-img-ui-s{$key}" type="hidden" name="catpost[{$vo.name}]" value="{$post[$vo.name]|default=''}">
                        </div>
                    </div>
                 
                </div>
            </div>
            <script type="text/javascript">
                uploadOneImg('layui-img-ui{$key}','layui-img-ui-s{$key}','imgsrc-{$vo.name}-{$key}');
            </script>
        </case>
        <!-- 单图上传结束 -->
        <!-- 附件上传开始 -->
        <case value="file">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-upload layui-input-block">
                  <button type="button" class="layui-btn" id="layui-file-ui{$key}"><i class="layui-icon"></i>上传文件</button>
                  <span class="layui-file-ui{$key}">{$post[$vo.name]|default=''}</span>
                  <input id="layui-file-one{$key}" type="hidden" name="catpost[{$vo.name}]" value="{$post[$vo.name]|default=''}">
                </div>
            </div>
            <script type="text/javascript">
                uploadFileOne('layui-file-ui{$key}','layui-file-one{$key}');
            </script>
        </case>
        <!-- 附件上传结束 -->
        <!-- 视频上传开始 -->
        <case value="media">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-upload layui-input-block">
                    <input style="width: 350px;float: left;" id="file-video{$vo.name}" class="form-control" type="text" name="catpost[{$vo.name}]" value="{$post[$vo.name]|default=''}" placeholder="请上传视频文件">
                    <a style="float: left;line-height: 30px;margin-left: 10px" href="javascript:uploadOne('文件上传','#file-video{$vo.name}','video');">上传</a>
                </div>
            </div>
        </case>
        <!-- 视频上传结束 -->
        <!-- 多行文本开始 -->
        <case value="multitext">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-input-block">
                    <textarea class="form-control" name="catpost[{$vo.name}]" style="height: 50px;"
                              placeholder="请填写{$vo.title}">{$post[$vo.name]|default=''}</textarea>
                </div>
            </div>
        </case>
        <!-- 多行文本结束 -->
        <!-- 下拉选择开始 -->
        <case value="select">
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <php>
                    $dfvalue = explode(',',$vo['dfvalue']);
                </php>
                <div class="col-md-6 col-sm-10" id="input-status">
                    <select class="form-control" name="catpost[{$vo.name}]">
                        <volist name="dfvalue" id="v">
                            <option {$v==$post[$vo.name] ? 'selected' : ''} value="{$v}">{$v}</option>
                        </volist>
                    </select>
                </div>
            </div>
        </case>
        <!-- 下拉选择结束 -->
        <!-- 多图上传开始 -->
        <case value="imgs">
            <script type="text/html" id="photos-item-tpl{$vo.name}">
                <li id="saved-image{$vo.name}{id}">
                    <input id="photo-{id}" type="hidden" name="catpost[{$vo.name}][]" value="{filepath}">
                    <input class="form-control" id="photo-{id}-name" type="text" value="{name}"
                           style="width: 200px;" title="图片名称">
                    <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
                         onclick="imagePreviewDialog(this.src);">
                    <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
                    <a href="javascript:(function(){$('#saved-image{$vo.name}{id}').remove();})();">移除</a>
                </li>
            </script>
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo.title}</label>
                <div class="layui-upload layui-input-block" style="padding-top:10px;">
                    <ul id="photos{$vo.name}" class="pic-list list-unstyled form-inline" style="margin-bottom: 0;width: 100%;display: flex;justify-content: flex-start;flex-wrap: wrap;width: 38%">
                        <notempty name="$post[$vo.name]">
                            <php>
                                $res = json_decode($post[$vo['name']]);
                            </php>
                            <volist name="res" id='ivo'>
                                <li id="saved-image{$vo.name}{$key}" style="width: 22%;text-align: center;margin-right: 10px">
                                    <div>
                                        <input id="photo-{$vo.name}-{$key}" type="hidden" name="catpost[{$vo.name}][]"
                                               value="{$ivo}">
                                        <img id="photo-{$vo.name}-{$key}-preview"
                                             src="{:cmf_get_image_preview_url($ivo)}"
                                             style="width: 100%;height:100px;"
                                             onclick="parent.imagePreviewDialog(this.src);">
                                    </div>
                                    <div>
                                        <a href="javascript:uploadOneImage('图片上传','#photo-{$vo.name}-{$key}');">替换</a>
                                        <a href="javascript:(function(){$('#saved-image{$vo.name}{$key}').remove();})();">移除</a>
                                    </div>
                                </li>
                            </volist>
                        </notempty>
                    </ul>
                    <a href="javascript:uploadMultiImage('多图上传','#photos{$vo.name}','photos-item-tpl{$vo.name}');"
                       class="btn btn-sm btn-default" style="background: #006fc4;padding: 8px 22px;color: #fff;border-radius: 5px;">选择图片</a>
                </div>
            </div>
        </case>
        <!-- 多图上传结束 -->
        <default />

    </switch>
</volist>
